{% extends 'base.html' %}
{% load static %}

{% block title %}
    <title>组信息</title>
{% endblock title %}

{% block navheader %}
    <section class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">
                    <h1>{{ group.group_name }}信息</h1>
                </div>
                <div class="col-sm-6">
                    <ol class="breadcrumb float-sm-right">
                        <li class="breadcrumb-item"><a href="{% url 'assets:dashboard' %}">首页</a></li>
                        <li class="breadcrumb-item"><a href="{% url 'user:grouplists' %}">组列表</a></li>
                        <li class="breadcrumb-item active">组信息</li>
                    </ol>
                </div>
            </div>
        </div><!-- /.container-fluid -->
    </section>
{% endblock navheader %}

{% block content %}
    <div class="card">
        <div class="card-header">
            <h3 class="card-title">组信息</h3>
        </div>
        <!-- /.card-header -->
        <div class="card-body row">
            <div class="col-3 pt-1 pb-1 border-bottom">组名：</div>
            <div class="col-9 pt-1 pb-1 border-bottom">{{ group.group_name }}</div>
            <div class="col-3 pt-1 pb-1 border-bottom">组内用户：</div>
            <div class="col-9 pt-1 pb-1 border-bottom">{% if group.user_set.all %}{% for user in group.user_set.all %}
                <a href="{% url 'user:user_detail' user.id %}" class="btn btn-sm btn-success btn-flat">{{ user.username }}</a>
                &nbsp;&nbsp;{% endfor %}{% else %}{% endif %}</div>
            <div class="col-3 pt-1 pb-1 border-bottom">拥有主机数：</div>
            <div class="col-9 pt-1 pb-1 border-bottom">{{ group.remote_user_bind_hosts.all.count }}</div>
            <div class="col-3 pt-1 pb-1 border-bottom">备注：</div>
            <div class="col-9 pt-1 pb-1 border-bottom">{{ group.memo | default:'' }}</div>
            <div class="col-3 pt-1 pb-1">创建时间：</div>
            <div class="col-9 pt-1 pb-1">{{ group.create_time | date:"Y/m/d H:i:s" }}</div>
        </div>
        <!-- /.card-body -->
    </div>
    <!-- /.card -->
{% endblock content %}
